package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	PaperLinksEventNew           = "mes.PaperLinksNew"
	PaperLinksEventBeforeCreate  = "mes.PaperLinksBeforeCreate"
	PaperLinksEventBeforeUpdate  = "mes.PaperLinksBeforeUpdate"
	PaperLinksEventBeforeSave    = "mes.PaperLinksBeforeCreate mes.PaperLinksBeforeUpdate"
	PaperLinksEventAfterCreate   = "mes.PaperLinksAfterCreate"
	PaperLinksEventAfterUpdate   = "mes.PaperLinksAfterUpdate"
	PaperLinksEventAfterSave     = "mes.PaperLinksAfterCreate mes.PaperLinksAfterUpdate"
	PaperLinksEventDelete        = "mes.PaperLinksDelete"
	PaperLinksAccessControlEvent = "mes.PaperLinksAccessControl"
)

func GetPaperLinksConfig() *mgo.DocConfig {
	return PaperLinks_Config
}

var PaperLinks_Config *mgo.DocConfig

func init() {
	PaperLinks_Config = NewPaperLinksConfig()
}
func NewPaperLinksConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "mes.PaperLinks",
		Fields: []string{
			"srcPaper", "destPaper", "numUse",
		},
		RelationFields: []string{
			"srcPaper", "destPaper",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"srcPaper": {
				Config:     GetPaperConfig,
				DocName:    "Paper",
				JoinType:   "O",
				KeyInside:  "srcPaperId",
				KeyOutSide: "id",
			},
			"destPaper": {
				Config:     GetPaperConfig,
				DocName:    "Paper",
				JoinType:   "O",
				KeyInside:  "destPaperId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
